<template>
  <div class="son">
    <h1>Son组件</h1>
    <button @click="dalogShow = true">显示弹窗组件</button>
    <Dalog v-if="dalogShow"></Dalog>
  </div>
</template>

<script>
import Dalog from './Dalog.vue';
import { provide, ref } from 'vue';
export default {
  name: 'Son-Comp',
  components: { Dalog },
  setup() {
    let dalogShow = ref(false);

    function closeDalogFn() {
      dalogShow.value = false;
    }

    provide('closeDalog',closeDalogFn)

    return {
      dalogShow,
      closeDalogFn
    }
  }
}
</script>

<style>
.son {
  background-color: orange;
  padding: 20px;
}
</style>
